//
//  LKAddBankCardViewController.m
//  YLHelper
//
//  Created by she1323 on 2018/5/7.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKAddBankCardViewController.h"
#import "LKAddProtocalMessageCell.h"
#import "LKDayInforPersonEditSpecialCell.h"
#import "LKChooseBankCardViewController.h"
#import "LKWorkOrderDetailContractCell.h"

#import "GFAddressPicker.h"
#import "LKPictureDeleteOrAddCell.h"
#import "HXPhotoPicker.h"
#import "LKPictureDeleteOrAddModel.h"
@interface LKAddBankCardViewController ()<UITableViewDelegate,UITableViewDataSource,UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIViewControllerTransitioningDelegate,GFAddressPickerDelegate>
@property(nonatomic,strong)LKBaseTableview *tableview;
@property(nonatomic,strong)NSArray *titlesArray;

@property(nonatomic,assign)NSInteger selectValue;
@property(nonatomic,strong)GFAddressPicker *addpickerView;
@property (strong, nonatomic) HXDatePhotoToolManager *toolManager;
@property (strong, nonatomic) NSMutableArray *dataArray;
@end

@implementation LKAddBankCardViewController
- (HXDatePhotoToolManager *)toolManager {
    if (!_toolManager) {
        _toolManager = [[HXDatePhotoToolManager alloc] init];
    }
    return _toolManager;
}
-(LKAddCustomerModel *)model{
    if (!_model) {
        _model = [[LKAddCustomerModel alloc] init];
    }
    return _model;
}
-(RACSubject *)bankCardModel{
    if (!_bankCardModel) {
        _bankCardModel = [RACSubject subject];
    }
    return _bankCardModel;
}
-(LKBaseTableview *)tableview{
    if (!_tableview) {
        _tableview = [LKBaseTableview setTableviewWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT + 10, WIDTH , HEIGHT - NAVIGATION_BAR_HEIGHT - 10) style:UITableViewStylePlain registercellClasss:@[@"LKAddProtocalMessageCell",@"LKWorkOrderDetailContractCell"]];
        [_tableview registerClass:[LKPictureDeleteOrAddCell class] forCellReuseIdentifier:@"LKPictureDeleteOrAddCell"];
        [self.view addSubview:_tableview];
        _tableview.delegate = self;
        _tableview.dataSource = self;
        _tableview.backgroundColor = [UIColor whiteColor];
        _tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _tableview;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.isAutenticd = @"1";
    if ([self.identCatogry isEqual:@"1"]) {
        if ([self.isAutenticd boolValue]) {
                      self.titlesArray = @[@"开户行：",@"开户行支行：",@"开户行支行省市：",@"卡号：",@"预留手机号"];
        }else{
          self.titlesArray = @[@"户名：",@"开户行：",@"开户行支行：",@"开户行支行省市：",@"卡号：",@"银行卡正面附件："];
        }

    }else{
        self.titlesArray = @[@"户名：",@"开户行：",@"开户行支行：",@"开户行支行省市：",@"卡号：",@"银行卡正面附件："];
    }
    if (self.isBankCardEdit) {
        self.model.AccountCode = self.bankDic[@"AccountCode"];
        self.model.AccountName = self.bankDic[@"AccountName"];
        self.model.AccountPhotoUrl = self.bankDic[@"AccountPhotoUrl"];
        self.model.BankCity = self.bankDic[@"BankCity"];
        self.model.BankName = self.bankDic[@"BankName"];
        self.model.BankBranch = self.bankDic[@"BankBranch"];
        self.model.BankCardTel = self.bankDic[@"BankCardTel"];
        self.model.IsAuthenticated = self.isAutenticd;
    }else{
        self.model.AccountName = self.customeName;
    }
    
//    self.dataArray = [NSMutableArray array];
//    for (int i = 0; i < 10; i++) {
//        LKPictureDeleteOrAddModel *model = [[LKPictureDeleteOrAddModel alloc] init];
//        [self.dataArray addObject:model];
//    }
    self.tableview.estimatedRowHeight = 200;
//    [self.tableview reloadData];
    // Do any additional setup after loading the view.
}
-(void)setNavgationBackBtn{
    [super setNavgationBackBtn];
    self.navigationItem.title = @"添加银行卡";
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.titleLabel.font = [UIFont systemFontOfSize:16];
    [btn setTitle:@"保存" forState:UIControlStateNormal];
    [btn setTitleColor:blueDefault forState:UIControlStateNormal];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
    [btn addTarget:self action:@selector(sendModelValue) forControlEvents:UIControlEventTouchUpInside];
}

/**
 反向传值model
 */
-(void)sendModelValue{
//    weakSelf.model.BankBranch = model.BankBranch;
//    weakSelf.model.BankName = model.BankName;
//    weakSelf.model.BankCity = model.BankCity;
//    weakSelf.model.AccountName = model.AccountName;
//    weakSelf.model.AccountCode = model.AccountCode;
//    weakSelf.model.AccountPhoto = model.AccountPhoto;
//    weakSelf.model.BankCity = model.BankCity;
    if (self.isBankCardEdit) {
        if (self.editBankCardBlock) {
            self.editBankCardBlock(self.model);
            [self.navigationController popViewControllerAnimated:YES];
            return;
        }
    }
    
    if (!self.model.BankCity) {
        [SVProgressHUD showInfoWithStatus:@"请选择开户行"];
        return;
    }
    if (!self.model.BankName) {
        [SVProgressHUD showInfoWithStatus:@"银行卡名称"];
        return;
    }
    if (!self.model.BankBranch) {
        [SVProgressHUD showInfoWithStatus:@"请输入开户行支行"];
        return;
    }
    if (!self.model.AccountCode) {
        [SVProgressHUD showInfoWithStatus:@"请输入卡号"];
        return;
    }
//    if (!self.model.AccountName) {
//        [SVProgressHUD showInfoWithStatus:@"请输入户名"];
//        return;
//    }
    self.model.IsAuthenticated = @"1";
    [self.bankCardModel sendNext:self.model];
    [self.navigationController popViewControllerAnimated:YES];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.titlesArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([self.identCatogry isEqual:@"1"]) {
        if ([self.isAutenticd boolValue]) {
            LKAddProtocalMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKAddProtocalMessageCell"];
            cell.titleLabel.text = self.titlesArray[indexPath.row];
            cell.arrowBtn.hidden = YES;
            cell.lineView.hidden = YES;
            cell.pictureImageView.hidden = YES;
            cell.contentTF.tag = 10000  + indexPath.row;
            [cell.contentTF addTarget:self action:@selector(changeValue:) forControlEvents:UIControlEventEditingChanged];
            if (indexPath.row == 2) {
                cell.arrowBtn.hidden = NO;
                cell.contentTF.enabled = NO;
                cell.contentTF.placeholder = @"";
                if (self.isBankCardEdit) {
                    cell.contentTF.text = self.model.BankCity;
                }
            }else{
                switch (indexPath.row) {
                        //                case 0:
                        //                {
                        //                    cell.contentTF.placeholder = @"请按照银行卡开户名规范填写";
                        //                    cell.contentTF.text = self.model.AccountName;
                        //                }
                        //                    break;
                    case 0:
                    {
                        cell.contentTF.placeholder = @"请按照银行卡卡片上的名称填写";
                        cell.contentTF.text = self.model.BankName;
                    }
                        break;
                    case 1:
                    {
                        cell.contentTF.placeholder = @"支行名称规范填写";
                        cell.contentTF.text = self.model.BankBranch;
                    }
                        break;
                    case 2:
                    {
                        cell.contentTF.text = self.model.BankCity;
                    }
                        break;
                    case 3:
                    {
                        cell.contentTF.placeholder = @"";
                        cell.contentTF.text = self.model.AccountCode;
                    }
                        break;
                    case 4:
                    {
                        cell.contentTF.placeholder = @"";
                        cell.contentTF.text = self.model.BankCardTel;
                    }
                        break;
                    default:
                        break;
                }
            }
            return cell;
        }else{
            LKAddProtocalMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKAddProtocalMessageCell"];
            cell.titleLabel.text = self.titlesArray[indexPath.row];
            cell.arrowBtn.hidden = YES;
            cell.lineView.hidden = YES;
            cell.pictureImageView.hidden = YES;
            cell.contentTF.tag = 10000  + indexPath.row;
            [cell.contentTF addTarget:self action:@selector(changeValue:) forControlEvents:UIControlEventEditingChanged];
            if (indexPath.row == 3) {
                cell.arrowBtn.hidden = NO;
                cell.contentTF.enabled = NO;
                cell.contentTF.placeholder = @"";
                if (self.isBankCardEdit) {
                    cell.contentTF.text = self.model.BankCity;
                }
            }else{
                switch (indexPath.row) {
                    case 0:
                    {
                        cell.contentTF.placeholder = @"请按照银行卡开户名规范填写";
                        cell.contentTF.text = self.model.AccountName;
                    }
                        break;
                    case 1:
                    {
                        cell.contentTF.placeholder = @"请按照银行卡卡片上的名称填写";
                        cell.contentTF.text = self.model.BankName;
                    }
                        break;
                    case 2:
                    {
                        cell.contentTF.placeholder = @"支行名称规范填写";
                        cell.contentTF.text = self.model.BankBranch;
                    }
                        break;
                    case 3:
                    {
                        cell.contentTF.text = self.model.BankCity;
                    }
                        break;
                    case 4:
                    {
                        cell.contentTF.placeholder = @"";
                        cell.contentTF.text = self.model.AccountCode;
                    }
                        break;
                    default:
                        break;
                }
            }
            if (indexPath.row == self.titlesArray.count - 1) {
                LKWorkOrderDetailContractCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderDetailContractCell"];
                cell.arrorBtn.hidden = YES;
                cell.iconImageView.userInteractionEnabled = YES;
                cell.iconImageView.image = [UIImage imageNamed:@"shangchuan"];
                cell.titleLabel.text = self.titlesArray[indexPath.row];
                [cell.iconImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.AccountPhotoUrl]] placeholderImage:[UIImage imageNamed:@"shangchuan"]];
                UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoPickPiture:)];
                [cell.iconImageView addGestureRecognizer:tap];
                cell.iconImageView.tag = 100 + indexPath.row;
                return cell;
                
            }
            return cell;
        }

    }else{
        LKAddProtocalMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKAddProtocalMessageCell"];
        cell.titleLabel.text = self.titlesArray[indexPath.row];
        cell.arrowBtn.hidden = YES;
        cell.lineView.hidden = YES;
        cell.pictureImageView.hidden = YES;
        cell.contentTF.tag = 10000  + indexPath.row;
        [cell.contentTF addTarget:self action:@selector(changeValue:) forControlEvents:UIControlEventEditingChanged];
        if (indexPath.row == 3) {
            cell.arrowBtn.hidden = NO;
            cell.contentTF.enabled = NO;
            cell.contentTF.placeholder = @"";
            if (self.isBankCardEdit) {
                cell.contentTF.text = self.model.BankCity;
            }
        }else{
            switch (indexPath.row) {
                case 0:
                {
                    cell.contentTF.placeholder = @"请按照银行卡开户名规范填写";
                    cell.contentTF.text = self.model.AccountName;
                }
                    break;
                case 1:
                {
                    cell.contentTF.placeholder = @"请按照银行卡卡片上的名称填写";
                    cell.contentTF.text = self.model.BankName;
                }
                    break;
                case 2:
                {
                    cell.contentTF.placeholder = @"支行名称规范填写";
                    cell.contentTF.text = self.model.BankBranch;
                }
                    break;
                case 3:
                {
                    cell.contentTF.text = self.model.BankCity;
                }
                    break;
                case 4:
                {
                    cell.contentTF.placeholder = @"";
                    cell.contentTF.text = self.model.AccountCode;
                }
                    break;
                default:
                    break;
            }
        }
        if (indexPath.row == self.titlesArray.count - 1) {
            LKWorkOrderDetailContractCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKWorkOrderDetailContractCell"];
            cell.arrorBtn.hidden = YES;
            cell.iconImageView.userInteractionEnabled = YES;
            cell.iconImageView.image = [UIImage imageNamed:@"shangchuan"];
            cell.titleLabel.text = self.titlesArray[indexPath.row];
            [cell.iconImageView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",ServerlUrl,self.model.AccountPhotoUrl]] placeholderImage:[UIImage imageNamed:@"shangchuan"]];
            UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoPickPiture:)];
            [cell.iconImageView addGestureRecognizer:tap];
            cell.iconImageView.tag = 100 + indexPath.row;
            return cell;
            
        }
        return cell;
    }

}

/**
 监听输入框的文本变化

 */
-(void)changeValue:(UITextField *)textfild{
    if ([self.identCatogry isEqual:@"1"]) {
        if ([self.isAutenticd boolValue]) {
            switch (textfild.tag) {
                case 10000:
                {
                    self.model.BankName = textfild.text;
                }
                    break;
                case 10001:
                {
                    self.model.BankBranch = textfild.text;
                }
                    break;
                case 10003:
                {
                    self.model.AccountCode = textfild.text;
                }
                    break;
                case 10004:
                {
                    self.model.BankCardTel = textfild.text;
                }
                    break;
                default:
                    break;
            }
        }else{
            switch (textfild.tag) {
                case 10000:
                {
                    self.model.AccountName = textfild.text;
                }
                    break;
                case 10001:
                {
                    self.model.BankName = textfild.text;
                }
                    break;
                case 10002:
                {
                    self.model.BankBranch = textfild.text;
                }
                    break;
                case 10004:
                {
                    self.model.AccountCode = textfild.text;
                }
                    break;
                case 10005:
                {
                    self.model.AccountCode = textfild.text;
                }
                    break;
                default:
                    break;
            }
        }
 
    }else{
        switch (textfild.tag) {
            case 10000:
            {
                self.model.AccountName = textfild.text;
            }
                break;
            case 10001:
            {
                self.model.BankName = textfild.text;
            }
                break;
            case 10002:
            {
                self.model.BankBranch = textfild.text;
            }
                break;
            case 10004:
            {
                self.model.AccountCode = textfild.text;
            }
                break;
            case 10005:
            {
                self.model.AccountCode = textfild.text;
            }
                break;
            default:
                break;
        }
    }


}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
//    if (indexPath.section == self.titlesArray.count - 1) {
//        LKPictureDeleteOrAddModel *model = self.dataArray[indexPath.section];
//        return model.cellHeight;
//    }
    if ([self.identCatogry isEqual:@"1"]) {
       return 80;
    }else{
       return indexPath.row == self.titlesArray.count - 1 ? 150 : 80;
    }
    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if ([self.identCatogry isEqual:@"1"]) {
        if ([self.isAutenticd boolValue]) {
            switch (indexPath.row) {
                case 0:
                {
                    
                }
                    break;
                case 1:
                {
                    
                }
                    break;
                case 2:
                {
                    [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
                    if (!_addpickerView) {
                        _addpickerView = [[GFAddressPicker alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
                        [_addpickerView updateAddressAtProvince:@"上海市" city:@"上海市" town:@"浦东新区"];
                        _addpickerView.delegate = self;
                        _addpickerView.font = [UIFont boldSystemFontOfSize:18];
                    }
                    [self.view addSubview:self.addpickerView];
                    [self.view bringSubviewToFront:self.addpickerView];
                }
                    break;
                case 4:
                {
                    
                }
                    break;
                case 5:
                {
                    
                }
                    break;
                default:
                    break;
            }
        }else{
            switch (indexPath.row) {
                case 0:
                {
                    
                }
                    break;
                case 1:
                {
                    
                }
                    break;
                case 2:
                {
                    //            LKChooseBankCardViewController *vc = [[LKChooseBankCardViewController alloc] init];
                    //            [self.navigationController pushViewController:vc animated:YES];
                }
                    break;
                case 3:
                {
                    [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
                    if (!_addpickerView) {
                        _addpickerView = [[GFAddressPicker alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
                        [_addpickerView updateAddressAtProvince:@"上海市" city:@"上海市" town:@"浦东新区"];
                        _addpickerView.delegate = self;
                        _addpickerView.font = [UIFont boldSystemFontOfSize:18];
                    }
                    [self.view addSubview:self.addpickerView];
                    [self.view bringSubviewToFront:self.addpickerView];
                }
                    break;
                case 4:
                {
                    
                }
                    break;
                case 5:
                {
                    
                }
                    break;
                default:
                    break;
            }
        }

    }else{
        switch (indexPath.row) {
            case 0:
            {
                
            }
                break;
            case 1:
            {
                
            }
                break;
            case 2:
            {
                //            LKChooseBankCardViewController *vc = [[LKChooseBankCardViewController alloc] init];
                //            [self.navigationController pushViewController:vc animated:YES];
            }
                break;
            case 3:
            {
                [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
                if (!_addpickerView) {
                    _addpickerView = [[GFAddressPicker alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
                    [_addpickerView updateAddressAtProvince:@"上海市" city:@"上海市" town:@"浦东新区"];
                    _addpickerView.delegate = self;
                    _addpickerView.font = [UIFont boldSystemFontOfSize:18];
                }
                [self.view addSubview:self.addpickerView];
                [self.view bringSubviewToFront:self.addpickerView];
            }
                break;
            case 4:
            {
                
            }
                break;
            case 5:
            {
                
            }
                break;
            default:
                break;
        }
    }

}
#pragma mark -地址选择器的代理方法
- (void)GFAddressPickerCancleAction
{
    [self.addpickerView removeFromSuperview];
}

- (void)GFAddressPickerWithProvince:(NSString *)province
                               city:(NSString *)city area:(NSString *)area
{
    if ([self.identCatogry isEqual:@"1"]) {
        if ([self.isAutenticd boolValue]) {
            LKAddProtocalMessageCell *cell = (LKAddProtocalMessageCell *)[self.tableview cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]];
            self.model.BankCity = [NSString stringWithFormat:@"%@ %@ %@",province,city,area];
            cell.contentTF.text = self.model.BankCity;
            [self.addpickerView removeFromSuperview];
        }else{
            LKAddProtocalMessageCell *cell = (LKAddProtocalMessageCell *)[self.tableview cellForRowAtIndexPath:[NSIndexPath indexPathForRow:3 inSection:0]];
            self.model.BankCity = [NSString stringWithFormat:@"%@ %@ %@",province,city,area];
            cell.contentTF.text = self.model.BankCity;
            [self.addpickerView removeFromSuperview];
        }

    }else{
        LKAddProtocalMessageCell *cell = (LKAddProtocalMessageCell *)[self.tableview cellForRowAtIndexPath:[NSIndexPath indexPathForRow:3 inSection:0]];
        self.model.BankCity = [NSString stringWithFormat:@"%@ %@ %@",province,city,area];
        cell.contentTF.text = self.model.BankCity;
        [self.addpickerView removeFromSuperview];
    }

}
-(void)gotoPickPiture:(UITapGestureRecognizer *)tap{
     [[[UIApplication sharedApplication] keyWindow] endEditing:YES];
    UIView *view = tap.view;
    self.selectValue = view.tag;
    //             判断是否支持相机
        if(![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
            [SVProgressHUD showInfoWithStatus:@"无法使用相机"];
            return;
        }
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    NSUInteger sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self camerOrAlbumsPhotoChooseWithAlert:alert AndSourceType:sourceType];
    [self presentViewController:alert animated:YES completion:nil];
}
/**
 从相册或者相机中选择图片
 
 @param alert 弹框
 @param sourceTypea 相机或者相册
 */
-(void)camerOrAlbumsPhotoChooseWithAlert:(UIAlertController *)alert AndSourceType:(NSInteger) sourceTypea{
    __block NSInteger sourceType = sourceTypea;
    [alert addAction:[UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        //来源:相机
        sourceType = UIImagePickerControllerSourceTypeCamera;
        // 跳转到相机或相册页面
        UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
        imagePickerController.delegate = (id)self;
        imagePickerController.allowsEditing = NO;
        imagePickerController.sourceType = sourceType;
        imagePickerController.transitioningDelegate = self;
        imagePickerController.modalPresentationStyle = UIModalPresentationCustom;
        [self presentViewController:imagePickerController animated:YES completion:nil];
        
    }]];
    [alert addAction:[UIAlertAction actionWithTitle:@"从相册选取" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        //来源:相册
        sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        // 跳转到相机或相册页面
        UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
        imagePickerController.delegate = (id)self;
        imagePickerController.allowsEditing = NO;
        imagePickerController.navigationBar.translucent = NO;
        [imagePickerController.navigationBar setBarTintColor:blueDefault];
        imagePickerController.sourceType = sourceType;
        imagePickerController.transitioningDelegate = self;
        imagePickerController.modalPresentationStyle = UIModalPresentationCustom;
        [self presentViewController:imagePickerController animated:YES completion:nil];
        
    }]];
    [alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
    }]];
}
#pragma mark - 调用相机的代理方法
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{
    [self dismissViewControllerAnimated:YES completion:nil];
    WS(weakSelf)
    UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
    LKWorkOrderDetailContractCell *cell = [_tableview cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.selectValue - 100 inSection:0]];
    UIImage *aimage = image;
    cell.iconImageView.image = aimage;
    self.model.AccountPhoto = aimage;
    [[LKNetDataManager defaultManager] sendPOSTRequestWithserverUrl:ServerlUrl apiPath:otherOfPictureUrl parameters:nil imageArray:@[aimage] targetWidth:100 progress:^(NSProgress * _Nullable progress) {
        
    } success:^(BOOL isSuccess, id  _Nullable responseObject) {
        weakSelf.model.AccountPhotoUrl = responseObject[@"fileUrl"];
    } failure:^(NSString * _Nullable error) {
        
    }];
}
//缩放图片到指定大小的imageview
- (UIImage*)imageCompressWithSimple:(UIImage*)image scaledToSize:(CGSize)size
{
    UIGraphicsBeginImageContext(size);
    [image drawInRect:CGRectMake(0,0,size.width,size.height)];
    UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}
//-(NSArray *)titlesArray{
//    if (!_titlesArray) {
//        _titlesArray = @[@"户名：",@"开户行：",@"开户行支行：",@"开户行支行省市：",@"卡号：",@"银行卡正面附件："];
//    }
//    return _titlesArray;
//}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
